package com.szh.zx.gaoDingJavaBook.chapter8.one;

import java.util.Collection;
import java.util.HashSet;

public class ForeachTest {
	public static void main(String[] args) {
		Collection books = new HashSet();
		books.add("轻量级javaee企业级应用实战");
		books.add("疯狂java讲义");
		books.add("疯狂android讲义");
		for (Object obj :
				books) {
			String book = (String) obj;
			System.out.println(book);
//			下面代码会引发异常
			if (book.equals("疯狂java讲义")) {
				books.remove(book);
			}
		}
		System.out.println(books);
	}

}
